import 'package:ez_ic_led/commont/bg_bar_view.dart';
import 'package:ez_ic_led/commont/custom_pickerview.dart';
import 'package:flutter/material.dart';
import 'package:flutter_kit_audio/flutter_kit_audio.dart';

import '../tool/assets.dart';

class ModeView extends StatefulWidget {
  Function(int) onChanged;
  ModeView({super.key, required this.onChanged});

  @override
  State<ModeView> createState() => _ModeViewState();
}

class _ModeViewState extends State<ModeView> {
  final List<List<String>> _items = [modeList];
  int selectIndex = 0;
  @override
  Widget build(BuildContext context) {
    return BgBarView(
        barTag: assets.Mode_btn,
        child: Container(
          color: Colors.transparent,
          child: Center(
            child: SizedBox(
                width: 180,
                child: CustomPickerview(
                  items: _items,
                  selectIndexs: [selectIndex],
                  onChanged: (p0, p1) {
                    selectIndex = p1;
                    widget.onChanged(p1);
                    FlutterKitAudio.customSound(soundType: FlutterKitAudioCustomSoundType.click18);
                  },
                )),
          ),
        ));
  }
}
